package org.dtrd.modules.record.entity.po;


import com.baomidou.mybatisplus.annotation.*;
import lombok.Getter;
import lombok.Setter;
import org.dtrd.common.util.DateUtils;
import org.dtrd.modules.record.entity.bean.NutrientRecordInfo;

import java.util.Date;


/**
 * 营养素记录
 *
 * @author QR
 * @since 2021-12-06
 */
@Getter
@Setter
@TableName("dtrd_ent_rd_signin_nutrient_record")
public class DtrdEntRdSigninNutrientRecord {

    @TableId(value = "data_id", type = IdType.AUTO)
    private Integer dataId;

    @TableField("patient_id")
    private Integer patientId;

    /**
     * 营养素Id
     */
    @TableField("nutrient_id")
    private Integer nutrientId;

    /**
     * 记录日期
     */
    @TableField("record_date")
    private Date recordDate;

    /**
     * 使用营养素时间
     */
    @TableField("record_time")
    private Date recordTime;

    /**
     * 照片以 竖线 | 拼接
     */
    @TableField("nutrient_record_photo")
    private String nutrientRecordPhoto;

    /**
     * 服用营养素描述
     */
    @TableField("nutrient_record_describe")
    private String nutrientRecordDescribe;

    /**
     * 1-早,2-午,3-晚,4-睡前
     */
    @TableField("nutrient_record_type")
    private Integer nutrientRecordType;

    /**
     * 营养素规格
     */
    @TableField("nutrient_spec")
    private String nutrientSpec;

    /**
     * 用法用量
     */
    @TableField("nutrient_use_mode")
    private String nutrientUseMode;

    /**
     * 档案标记1-建档,0-日常监测
     */
    @TableField("nutrient_record_archive_tag")
    private Integer nutrientRecordArchiveTag;

    /**
     * 备注
     */
    @TableField("nutrient_record_remark")
    private String nutrientRecordRemark;

    @TableField("create_time")
    private Date createTime;

    @TableField("is_del")
    @TableLogic
    private Integer isDel;

    public Integer getDataId() {
        return dataId;
    }

    public void setDataId(Integer dataId) {
        this.dataId = dataId;
    }

    public Integer getPatientId() {
        return patientId;
    }

    public void setPatientId(Integer patientId) {
        this.patientId = patientId;
    }

    public Integer getNutrientId() {
        return nutrientId;
    }

    public void setNutrientId(Integer nutrientId) {
        this.nutrientId = nutrientId;
    }

    public Date getRecordDate() {
        return recordDate;
    }

    public void setRecordDate(Date recordDate) {
        this.recordDate = recordDate;
    }

    public Date getRecordTime() {
        return recordTime;
    }

    public void setRecordTime(Date recordTime) {
        this.recordTime = recordTime;
    }

    public String getNutrientRecordPhoto() {
        return nutrientRecordPhoto;
    }

    public void setNutrientRecordPhoto(String nutrientRecordPhoto) {
        this.nutrientRecordPhoto = nutrientRecordPhoto;
    }

    public String getNutrientRecordDescribe() {
        return nutrientRecordDescribe;
    }

    public void setNutrientRecordDescribe(String nutrientRecordDescribe) {
        this.nutrientRecordDescribe = nutrientRecordDescribe;
    }

    public Integer getNutrientRecordType() {
        return nutrientRecordType;
    }

    public void setNutrientRecordType(Integer nutrientRecordType) {
        this.nutrientRecordType = nutrientRecordType;
    }

    public String getNutrientSpec() {
        return nutrientSpec;
    }

    public void setNutrientSpec(String nutrientSpec) {
        this.nutrientSpec = nutrientSpec;
    }

    public String getNutrientUseMode() {
        return nutrientUseMode;
    }

    public void setNutrientUseMode(String nutrientUseMode) {
        this.nutrientUseMode = nutrientUseMode;
    }

    public Integer getNutrientRecordArchiveTag() {
        return nutrientRecordArchiveTag;
    }

    public void setNutrientRecordArchiveTag(Integer nutrientRecordArchiveTag) {
        this.nutrientRecordArchiveTag = nutrientRecordArchiveTag;
    }

    public String getNutrientRecordRemark() {
        return nutrientRecordRemark;
    }

    public void setNutrientRecordRemark(String nutrientRecordRemark) {
        this.nutrientRecordRemark = nutrientRecordRemark;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Integer getIsDel() {
        return isDel;
    }

    public void setIsDel(Integer isDel) {
        this.isDel = isDel;
    }

    public DtrdEntRdSigninNutrientRecord init() {
        createTime = new Date();
        isDel = 0;
        return this;
    }

    public DtrdEntRdSigninNutrientRecord parseFromDto(NutrientRecordInfo dto) {
        dataId = dto.getDataId();
        patientId = dto.getPatientId();
        nutrientId = dto.getNutrientId();
        Date date = DateUtils.getDate(dto.getRecordTime());
        if (date != null) {
            recordDate = date;
        }
        recordTime = dto.getRecordTime();
        nutrientRecordPhoto = dto.getNutrientRecordPhoto();
        nutrientRecordDescribe = dto.getNutrientRecordDescribe();
        nutrientRecordType = dto.getNutrientRecordType();
        nutrientSpec = dto.getNutrientSpec();
        nutrientUseMode = dto.getNutrientUseMode();
        nutrientRecordRemark = dto.getNutrientRecordRemark();
        return this;
    }


}

